package com.isunny.mode.tactics.service;

import com.isunny.mode.tactics.factory.EvictionStrategyAnnotationPareFactory;
import com.isunny.mode.tactics.strategy.EvictionStrategy;
import org.springframework.stereotype.Service;

/**
 * @author luom
 * @date 2022/2/25
 */
@Service
public class EvictionStrategyService {

    private final EvictionStrategyAnnotationPareFactory evictionStrategyFactory;

    public EvictionStrategyService(EvictionStrategyAnnotationPareFactory evictionStrategyFactory) {
        this.evictionStrategyFactory = evictionStrategyFactory;
    }

    public String select(String eviction) {
        EvictionStrategy evictionStrategy = evictionStrategyFactory.getEviction(eviction.toUpperCase());
        return evictionStrategy.evictionCache();
    }
}
